CC = $(CROSS_COMPILE)gcc
KERN_DIR = /home/fison/linux-4.9.88
BUILD_DIR = /home/fison/eb_sw/imx6ull/driver/build/driver

APP_SRCS = $(shell find . -name "*_test.c")
APP_OBJ = $(patsubst %.c, %.o, $(APP_SRCS))

all: mod

app:$(APP_OBJ)
	@echo "\e[33m Linking $(BUILD_DIR)/$@ \e[0m"
	$(CC)  $^ -o $(BUILD_DIR)/$(NAME)_test
	@echo "\e[32m Executable generated: $(BUILD_DIR)/$(NAME)_test \e[0m"
	@echo ""

mod:
	make -C $(KERN_DIR) M=`pwd` modules
	cp  *.ko $(BUILD_DIR)/
	@echo "\e[32m Executable generated in $(BUILD_DIR)/ \e[0m"


clean:
	make -C $(KERN_DIR) M=`pwd` modules clean
	rm -rf modules.order
	@echo  "\e[32m Clean complete \e[0m"
	@echo ""

NAME := gpio_key_platform_irq

#$(NAME)-y := $(NAME)_driver.o imx_board.o
obj-m += gpio_key_platform_driver.o 